<template>
    <div class="page">
        <el-row :gutter="20">
            <el-col :span="24" :xs="24" :sm="24" :lg="24">
                <div class="grid-content bg-purple">
                    <div class="panel">
                        <div class="panel-body">
                            <el-row :gutter="20">
                                <el-col :span="8" v-for="(v,k) in listData.data" :key="k">
                                    <el-card class="box-card">
                                        <div slot="header" class="clearfix">
                                            <el-row type="flex"  justify="space-between" :gutter="20">
                                                <el-col :span="24"><h3 class="whiteFont text-center">{{v.designation}}</h3></el-col>
                                            </el-row>
                                        </div>
                                        <div class="text item">
                                            <div>
                                                <el-row :gutter="20" type="flex"  justify="space-between">
                                                    <el-col :span="12"><p class="text-center">总签收件</p></el-col>
                                                    <el-col :span="12"><p class="text-center">{{v.total_sign}}</p></el-col>
                                                </el-row>
                                            </div>
                                            <div>
                                                <el-row :gutter="20" type="flex"  justify="space-between">
                                                    <el-col :span="12"><p class="text-center">单价</p></el-col>
                                                    <el-col :span="12"><p class="text-center">{{v.unit_price}}</p></el-col>
                                                </el-row>
                                            </div>
                                            <div>
                                                <el-row :gutter="20" type="flex"  justify="space-between">
                                                    <el-col :span="12"><p class="text-center">合计</p></el-col>
                                                    <el-col :span="12"><p class="text-center">{{v.total}}</p></el-col>
                                                </el-row>
                                            </div>
                                        </div>
                                    </el-card>
                                </el-col>
                            </el-row>
                        </div>
                        <div class="panel-footer text-center">
                            <el-pagination @size-change="sizeChange" @current-change="currentChange"
                                           :current-page="queryParams.page"
                                           :page-sizes="[5, 10, 20, 50]"
                                           :page-size="queryParams.paginate"
                                           layout="total, sizes, prev, pager, next, jumper"
                                           :total="listData.total">
                            </el-pagination>
                        </div>
                    </div>
                </div>
            </el-col>
        </el-row>
    </div>
</template>

<script>
    import api from '../apis'
    export default {
        name: "Cooperation",
        data(){
            return {
                listLoading:false,
                listData:{
                    data:[],
                    total:0,
                },
                queryParams:{
                    page:1,
                    paginate:5,
                },
            };
        },
        methods:{
            /**
             * 分页改变容量
             */
            sizeChange(size){
                this.queryParams.paginate(size);
                this.queryList();
            },
            /**
             *
             */
            currentChange(page){
                this.queryParams.page(page);
                this.queryList();
            },
            /**
             * 请求列表
             */
            queryList(){
                this.listLoading = true;
                api.cooperation.list(this.queryParams).then(response=>{
                    this.listData = response.data;
                    this.listLoading = false;
                }).catch(errors=>{

                })
            }
        },
        mounted(){
            this.queryList()
        }
    }
</script>

<style lang="scss" scoped>
    .item {
        div{
            margin-bottom: 8px;
        }
    }
</style>
